package com.shuai.staticProxy;

import com.shuai.staticProxy.impl.UserServiceImpl;
import com.shuai.staticProxy.proxy.UserServiceProxy;
import com.shuai.staticProxy.service.UserService;

import java.util.ArrayList;

/**
 * @author shuaihong-coding
 * @date 2025/10/3
 * @className StaticProxyMain
 */
public class StaticProxyMain {
    public static void main(String[] args){

        // 没有使用代理
        UserService userService = new UserServiceImpl();
        String userInfo = userService.getUserInfo("帅宏");
        System.out.println(userInfo);
        ArrayList<String> userList = new ArrayList<>();
        userList.add("帅");
        userList.add("小米");
        userList.add("小白");
        String userAll = userService.getUserAll(userList);
        System.out.println(userAll);

        System.out.println("-----------------------------------------------------");

        // 使用静态代理
        UserServiceProxy userServiceProxy = new UserServiceProxy();
        String userInfo1 = userServiceProxy.getUserInfo("帅宏");
        System.out.println(userInfo1);
        String userAll1 = userServiceProxy.getUserAll(userList);
        System.out.println(userAll1);
    }
}
